﻿namespace MathService.Values
{
    public class MinValue : IValue<double>, IResetable
    {
        private double f_Value;

        public double Value { get { return f_Value; } set { f_Value = value; } }

        public MinValue() { f_Value = double.MaxValue; }
        public MinValue(double StartValue) { f_Value = StartValue; }

        public bool AddValue(double value)
        {
            if(value < f_Value) { f_Value = value; return true; }
            return false;
        }

        public void Reset() { f_Value = double.PositiveInfinity; }

        public override string ToString() { return f_Value.ToString(); }
        public string ToString(string FormatString) { return f_Value.ToString(FormatString); }

        public static implicit operator double(MinValue MinValue) { return MinValue.f_Value; }
    }
}
